import {storeToRefs} from "pinia";
import {useAppStore} from "@/stores";
import {debounce} from "lodash-unified";


const { refreshPage } = storeToRefs(useAppStore());
export function useRefreshPageFn(callback: Function) {
  const deCallback = debounce(() => {
    callback()
  }, 1000);
  watch(() => refreshPage.value, () => {
    if (refreshPage.value) {
      deCallback();
    }
  })
}
